﻿using MediatR;
using SystemHYS.API.Application.command.RawmaterialtestingCommand;
using SystemHYS.Infrstructre.Interface;
namespace SystemHYS.API.Application.commandler.RawmaterialtestingCommandler
{
    public class RawmaterialtestingDeleteCommandler:IRequestHandler<RawmaterialtestingDeleteCommand,int>
    {
        IRawmaterialtestingRepository rawmaterialtestingRepository;
        public RawmaterialtestingDeleteCommandler(IRawmaterialtestingRepository rawmaterialtestingRepository)
        {
            this.rawmaterialtestingRepository = rawmaterialtestingRepository;
        }

        public async Task<int> Handle(RawmaterialtestingDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await rawmaterialtestingRepository.GetModelAsnc(request.RawMaterialtestingId);
            list.IsDel=true;
            return await rawmaterialtestingRepository.UpdateAsyn(list);
        }
    }
}
